package com.freshcity.page.friend
{
	import com.freshcity.component.container.Component;
	import com.freshcity.friend.LogWin;
	import com.freshcity.utils.MessageUtil;
	
	import fl.controls.UIScrollBar;
	
	import flash.display.DisplayObjectContainer;
	import flash.events.Event;
	import flash.text.StyleSheet;
	
	public class LogPanel extends Component
	{
		public var home:FriendHome;
		private var back:LogWin;
		
		private const CSS:String="".concat('.my_status{color: #C5C5C5;letter-spacing:4px;}', "a{color: #2595B7;}", ".c_tx4{color: #FE6600;}", "div{display: block;}", "span{}", "");
		
		public function LogPanel(parent:DisplayObjectContainer=null, xpos:Number=0, ypos:Number=0)
		{
			super(parent, xpos, ypos);
		}
		
		override protected function addChildren():void
		{
			super.addChildren();
			back = new LogWin();
			addChild(back);
			
			var sb:UIScrollBar = new UIScrollBar();
			sb.move(back.logTf.x + back.logTf.width, back.logTf.y);
			sb.setSize(sb.width, back.logTf.height);
			sb.scrollTarget = back.logTf;
			addChild(sb); 
			
			var style:StyleSheet=new StyleSheet();
			style.parseCSS(this.CSS);
			back.logTf.styleSheet=style;
		}
		
		override public function destroy():void
		{
			super.destroy();
		}
		
		override public function draw():void
		{
			// TODO Auto Generated method stub
			super.draw();
		}
		
		override public function show(event:Event=null):void
		{
			var log:* = home.asso.eventLog;
			back.logTf.htmlText=MessageUtil.decodeAssoLog(log);
			super.show(event);
		}
		
	}
}